
CXXFLAGS = -O4
#head file path
HEAD_INC =

#library file path
LD_FLAGS =

#libary your used
LIBS = 


#The source file type
SRC_EXTS = .c .C .cc .cpp .CPP

#The head file type
HEAD_EXTS = .h .H .hh .hpp .HPP

#define command
CXX = g++
CC = gcc

RM = rm -rf

TARGET_DIR = ./bin

TARGET = algorithmTest


SRC_DIRS = ./src

SRC_FILES = $(foreach d,$(SRC_DIRS),$(wildcard $(addprefix $(d)/*,$(SRC_EXTS))))
SRC_HEADER = $(foreach d,$(SRC_DIRS),$(wildcard $(addprefix $(d)/*,$(HEAD_EXTS))))

#object files

OBJS = $(addsuffix .o, $(basename $(SRC_FILES)))

## Define some useful variables.
#COMPILE.c   = $(CC)  $(CFLAGS)   $(CPPFLAGS) -c
COMPILE.cxx = $(CXX) $(CXXFLAGS) -c
#LINK.c      = $(CC)  $(CFLAGS)   $(CPPFLAGS) $(LDFLAGS)
LINK.cxx    = $(CXX) $(CXXFLAGS) $(LD_FLAGS)

.PHONY: all


all: $(TARGET)

# Rules for generating object files (.o).
#----------------------------------------
$(OBJS):%.o:%.cpp
	$(COMPILE.cxx) $< -o $@

$(TARGET):$(OBJS)
	$(LINK.cxx) $(OBJS) $(LIBS) -o $@
	mkdir $(TARGET_DIR)
	mv $@ $(TARGET_DIR)/$@

clean:$(OBJS)
	$(RM) $<
	$(RM) $(TARGET_DIR)

